package com.alibaba.cloud.json;

import com.alibaba.cloud.anno.Ignore;
import com.google.gson.ExclusionStrategy;
import com.google.gson.FieldAttributes;

/**
 * The Class CusExclusionStrategy.
 */
class CusExclusionStrategy implements ExclusionStrategy {

	/**
	 * Instantiates a new cus exclusion strategy.
	 */
	CusExclusionStrategy() {
		super();
	}

	/**
	 * Should skip field.
	 *
	 * @param attributes the attributes
	 * @return true, if successful
	 */
	@Override
	public boolean shouldSkipField(FieldAttributes attributes) {
		return attributes.getAnnotation(Ignore.class) != null;
	}

	/**
	 * Should skip class.
	 *
	 * @param clazz the clazz
	 * @return true, if successful
	 */
	@Override
	public boolean shouldSkipClass(Class<?> clazz) {
		return (clazz.getAnnotation(Ignore.class) != null);
	}

}